<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>课程列表</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="../../lib/layui-v2.5.5/css/layui.css" media="all">
    <link rel="stylesheet" href="../../css/public.css" media="all">
</head>
<body>
<div class="layuimini-container">
    <div class="layuimini-main">
        <table class="layui-hide" id="currentTableId" lay-filter="currentTableFilter"></table>
    </div>
</div>
<script src="../../lib/layui-v2.5.5/layui.js" charset="utf-8"></script>
<script>

    layui.use(['form', 'table'], function () {
        var id = window.localStorage.getItem("id");
        var $ = layui.jquery,
            form = layui.form,
            table = layui.table,
            layuimini = layui.layuimini;

        table.render({
            elem: '#currentTableId',
            url: '/course/selectByTeach?id='+id,
            defaultToolbar: ['filter', 'exports', 'print', {
                title: '提示',
                layEvent: 'LAYTABLE_TIPS',
                icon: 'layui-icon-tips'
            }],
            cols: [[
                {type: "checkbox", width: 50, fixed: "left"},
                {field: 'id', width: 60, title: 'ID', sort: true},
                {field: 'courseName', width: 100, title: '课程名称'},
                {field: 'coursePic', width: 100, title: '课程图片',
                    templet: '<div><img src="{{d.coursePic}}" width="30px" height="40px"></div>'},
                {field: 'courseDescription', width: 120, title: '课程描述', sort: true},
                {field: 'teachName', width: 100, title: '教师姓名'},
                {field: 'teachDescription', title: '教师描述', width: 150},
                {field: 'teachImage', title: '教师图片', width: 100,
                    templet: '<div><img src="{{d.teachImage}}" width="30px" height="40px"></div>'},
                {field: 'users', title: '适用人群', width: 150},
                {field: 'courseClassifyName', title: '课程类型', width: 170},
                {field: 'createtime', title: '创建时间', width: 100},
                {field: 'updatetime', title: '修改时间', width: 100},
                {field: 'pay', title: '课程金额', width: 100}
            ]],
            page: true
        });

        // 监听搜索操作
        form.on('submit(data-search-btn)', function (data) {
            var result = JSON.stringify(data.field);
            layer.alert(result, {
                title: '最终的搜索信息'
            });

            //执行搜索重载
            table.reload('currentTableId', {
                page: {
                    curr: 1
                }
                , where: {
                    searchParams: result
                }
            }, 'data');

            return false;
        });

    });
</script>
<script>

</script>

</body>
</html>